export const schema = {
    type: "page",
    title: "订单查看",
    body: [
        {
            type: "crud",
            api: "/api/userorder",
            panelClassName: "no-border no-shadow bg-white",
            toolbarInline: true,
            columnsTogglable: true,
            filter: {
                title: "",
                submitText: "",
                panelClassName: 'no-border no-shadow b-b m-b-none b-light',
                controls: [
                    [
                        {
                            label: '支付金额',
                            type: 'text',
                            name: 'cash_min',
                            placeholder: '支付金额(小)',
                            validations: 'isNumeric,minimum:0'
                            // max: '${cash_max}'
                        },
                        {
                            label: '到',
                            type: 'text',
                            name: 'cash_max',
                            placeholder: '支付金额(大)',
                            validations: 'minimum:0,isNumeric'
                        },
                        {
                            type: "select",
                            label: "项目状态",
                            name: "project_status",
                            options: [
                                {
                                    label: "全部",
                                    value: ""
                                },
                                {
                                    label: "待审核",
                                    value: "0"
                                },
                                {
                                    label: "已通过",
                                    value: "1"
                                },
                                {
                                    label: "已拒绝",
                                    value: "2"
                                }
                            ]
                        }

                    ],
                    [
                        {
                            label: "支付日期",
                            type: "date",
                            name: "pay_time",
                        },
                        {
                            // label: "关键字搜索",
                            type: 'text',
                            name: 'keyword',
                            placeholder: '姓名/手机号/项目名称'
                        },
                        {
                            type: "submit",
                            label: "搜索",
                            primary: true
                        }
                    ]

                    // {
                    //     type: "text",
                    //     name: "keyword",
                    //     placeholder: "用户名/团队名称/手机号/银行卡号",
                    //     style: {minWidth: 260},
                    //     addOn: {
                    //         type: "submit",
                    //         label: "搜索",
                    //         primary: true
                    //     }
                    // },
                    // {
                    //     label: "导出",
                    //     type: "button",
                    //     // size: "sm",
                    //     level: "info",
                    //     actionType: "url",
                    //     // className: "btn btn-info",
                    //     url: "/api/teamcashinfo?asExcel=1"
                    // },
                ]
            },
            columns: [
                {
                    label: "订单ID",
                    name: "id"
                },
                {
                    name: "org_id",
                    label: "所属团队",
                    type: "tpl",
                    tpl: `<% if (data.acl.can("team:view")) { %>
                    <a data-link='/team/view/<%= data.project.team.id %>'><%= data.project.team.name %></a>
                    <% } else { %>
                        <span><%= data.project.team.name %></span>
                        <% } %>`
                },
                // {
                //     name: "org_id",
                //     label: "所属机构",
                //     type: "tpl",
                //     tpl: `<% if (data.acl.can("org:view")) { %>
                //     <a data-link='/org/view/<%= data.org.id %>'><%= data.org.name %></a>
                //     <% } else { %>
                //         <span><%= data.org.name %></span>
                //         <% } %>`
                // },
                {
                    label: "购买物品",
                    type: "tpl",
                    tpl: "<% Array.isArray(data.goods_name) ? data.goods_name.map(function(goods_name) {%><span class='label label-info inline'><%= goods_name %></span><%}) : '' %>"
                },
                {
                    label: "订单用户",
                    name: 'volunteer.real_name'
                },
                {
                    label: "用户手机",
                    name: 'volunteer.phone'
                },
                {
                    label: "订单金额",
                    name: 'amount'
                },
                {
                    label: "项目",
                    name: 'project.name'
                },
                {
                    label: "支付时间",
                    name: 'pay_time'
                },

                {
                    label: "提现状态",
                    name: "status",
                    type: "map",
                    map: {
                        "0": "<span class='label label-warning'>未结算</span>",
                        "1": "<span class='label label-success'>已结算</span>",
                        "2": "<span class='label label-default'>已退款</span>",
                        "3": "<span class='label label-default'>结算中</span>",
                        "*": "${status}"
                    }
                },
                {
                    label: "用户加入项目状态",
                    name: "user_project.verify_status",
                    type: "map",
                    map: {
                        "-1": "<span class='label label-default'>编辑中</span>",
                        "0": "<span class='label label-warning'>待审核</span>",
                        "1": "<span class='label label-success'>已通过</span>",
                        "2": "<span class='label label-default'>已拒绝</span>",
                        "3": "<span class='label label-default'>已退出</span>",
                        "*": "${verify_status}"
                    }
                }
            ]
            // }
        }
    ]
};
